/** @file               sw_font.h
 *  @copyright          Copyright (C) 2006-2026 flyfish (tenggui_fu@126.com)
 *  @brief              This file is part of the swallow library
 *  @author             $Author: flyfish $
 *  @version            $Rev: 385 $
 *  @date               $Date: 2016-12-22 00:12:05 +0800 (周四, 22 12月 2016) $
 */
#ifndef __SW_FONT_H__
#define __SW_FONT_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef SW_VOID *SW_FONT;
#define SW_INVALID_FONT NULL

typedef enum _SW_FONT_TYPE
{
    SW_FT_TTF,
    SW_FT_RBF,
    SW_FT_INVALID = -1
}SW_FONT_TYPE;

SW_API SW_RET SW_InitFontAPI(SW_VOID);
SW_API SW_RET SW_RunFontAPI(SW_VOID);
SW_API SW_RET SW_StopFontAPI(SW_VOID);
SW_API SW_RET SW_ExitFontAPI(SW_VOID);
SW_API SW_FONT_TYPE SW_GetFontType(const SW_CHAR *pStr);
SW_API const SW_CHAR *SW_GetFontTypeStr(SW_FONT_TYPE type);
SW_API SW_FONT SW_OpenFont(const SW_CHAR *pFileName, SW_FONT_TYPE type, const SW_CHAR *pFamilyName, const SW_CHAR *pStyleName);
SW_API SW_RET SW_CloseFont(SW_FONT font);
SW_API SW_RET SW_GetFontStrBits(SW_FONT font, const SW_VOID *pStr, SW_UINT32 strLen, SW_UINT32 fontSize, SW_CHARSET charset, SW_VOID *pBits, SW_UINT32 *pWidth, SW_UINT32 *pHeight, SW_UINT32 *pBase);

#if !defined(SW_V_DISABLE_CMDSERVER) && defined(SW_V_WITH_FREETYPE)
SW_API SW_RET SW_CmdFontTest(const SW_CHAR *pFileName, const SW_CHAR *pText);
SW_API SW_RET SW_CmdFontDraw(const SW_CHAR *pFontFileName, const SW_CHAR *pImageFileName, const SW_CHAR *pBitsFileName, const SW_CHAR *pStr, SW_UINT32 fontSize);
#endif

#ifdef __cplusplus
}
#endif

#endif

